﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestXNA3.Components;
using System.Runtime.Serialization;

namespace TestXNA3.Actors
{
    [Serializable]
    public class SkyLight : Light
    {
        public SkyLight()
        {
            AttachComponent(new SkyLightComponent());

            Pitch = -90f;
            if (GameStartup.InEditor)
            {
                _spriteComponent = new SpriteComponent();
                _spriteComponent.Texture = new TestXNA3.Resources.TextureResource("sun-128x128");
                AttachComponent(_spriteComponent);
            }
        }

        public override void Load(System.IO.BinaryReader reader)
        {
            DetachComponent(Components[0]);
            base.Load(reader);

            if (GameStartup.InEditor)
            {
                _spriteComponent = new SpriteComponent();
                _spriteComponent.Texture = new TestXNA3.Resources.TextureResource("sun-128x128");
                AttachComponent(_spriteComponent);
            }
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
        }
    }
}
